from collections import deque

class FrameBuffer():
    def __init__(self):
        self.__content = deque()
    
    def append(self,pktlen,frame,ts):
        self.__content.append( (pktlen,frame,ts) )
            
    def count(self):
        return len(self.__content)
           
    def getpkt(self):
        return self.__content.popleft()

    def flush(self):
        self.__content.clear()

    def getall(self):
        pktlist = list(self.__content)
        self.flush()
        return pktlist

    